<?php
/**
 * @package DBpretty
 * @author WiFeng
 * @link http://521-wf.com
 */

class DBpretty_Options_Import extends DBpretty_Options
{
	public function execute() {
	
	}
	
	public function getFiles() {
		$backupFiles = array();
		$realBackupDir = DBpretty_Do::getAbsoluteBackupDir(false);
		if(is_dir($realBackupDir)) {
			if($handle = opendir($realBackupDir)) {
				$date = 0;
				while(false !== ($file = readdir($handle))) {
					if(substr($file, -4) == '.zip' || substr($file, -4) == '.sql' ) {
						$filemtime = filemtime($realBackupDir.$file);
						$key = $filemtime;
						$date = new Typecho_Date($filemtime);
						$filemtime = $date->format('Y-m-d H:i');
						$size = DBpretty_Options::transBytes(filesize($realBackupDir.$file));
						$backupFiles[$key] = array('name' => $file, 'filemtime' => $filemtime, 'size' => $size);
					}
				}
				closedir($handle);
			}
		}
		ksort($backupFiles);
		return $backupFiles;
	}
	
}